function quickSort(list, left, right) {
    let length = list.length;
    left = typeof left != 'number' ? 0 : left;
    right = typeof right != 'number' ? length - 1 : right;
    if (left < right) {
        // 获取基准点,进行分区
        partitionIndex = partition(list, left, right);
        // 递归调用基准左右的子序列进行快排
        console.log(list);
        quickSort(list, left, partitionIndex - 1);
        quickSort(list, partitionIndex + 1, right);
    }
    return list;
}

function partition(arr, left, right) {
    let privot = left;
    let index = left + 1;
    for (let i = index; i <= right; i++) {
        if (arr[i] < arr[privot]) {
            swap(arr, i, index);
            index++;
        }
    }
    swap(arr, privot, index - 1);
    return index - 1;
}
function swap(arr, i, j) {
    var temp = arr[i];
    arr[i] = arr[j];
    arr[j] = temp;
}

var list = [25, 13, 16, 7, 27, 33];
var res = quickSort(list);
// console.log(res);